package com.siwei.eqi.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.siwei.eqi.pojo.entity.DeliveryTaskBatchSubtask;
import com.siwei.eqi.mapper.DeliveryTaskBatchSubtaskMapper;
import com.siwei.eqi.pojo.vo.BatchResultVO;
import com.siwei.eqi.pojo.vo.SubtaskInfoVO;
import com.siwei.eqi.pojo.vo.SubtaskVO;
import com.siwei.eqi.service.IDeliveryTaskBatchSubtaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 汇交子任务表 服务实现类
 * </p>
 *
 * @author hzl
 * @since 2025-04-02
 */
@Service
public class DeliveryTaskBatchSubtaskServiceImpl extends ServiceImpl<DeliveryTaskBatchSubtaskMapper, DeliveryTaskBatchSubtask> implements IDeliveryTaskBatchSubtaskService {

    @Override
    public List<SubtaskVO> queryList(String batchId) {
        List<DeliveryTaskBatchSubtask> resultList = this.list(new LambdaQueryWrapper<DeliveryTaskBatchSubtask>()
                .eq(DeliveryTaskBatchSubtask::getBatchId, batchId));
        if (CollectionUtils.isEmpty(resultList)) {
            return Collections.emptyList();
        }
        return BeanUtil.copyToList(resultList, SubtaskVO.class);
    }

    @Override
    public SubtaskInfoVO detail(String id) {
        SubtaskInfoVO vo = new SubtaskInfoVO();
        // 根据子任务id查询详情
        DeliveryTaskBatchSubtask subtask = this.getById(id);
        SubtaskVO subtaskVO = BeanUtil.copyProperties(subtask, SubtaskVO.class);
        vo.setSubtaskVO(subtaskVO);
        return null;
    }
}
